package com.medicalproject.demo;

public class Result {
    private boolean success;
    private String message;
    private Object data;

    // 构造函数
    public Result(boolean success, String message, Object data) {
        this.success = success;
        this.message = message;
        this.data = data;
    }

    // 静态方法用于创建成功结果
    public static Result success(Object data) {
        return new Result(true, "操作成功", data);
    }

    // 静态方法用于创建错误结果
    public static Result error(String message) {
        return new Result(false, message, null);
    }

    // 静态方法用于创建错误结果并附带数据
    public static Result error(String message, Object data) {
        return new Result(false, message, data);
    }

    // Getter 和 Setter 方法
    public boolean isSuccess() {
        return success;
    }

    public void setSuccess(boolean success) {
        this.success = success;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }
}
